package com.liuh.okhttp.callback;

import okhttp3.Call;
import okhttp3.Request;
import okhttp3.Response;

public abstract class ICall<T> {

	public void onBefore(Request request) {
	}

	public void onAfter() {
	}

	/**
	 * Thread Pool Thread
	 *
	 * @param response
	 */
	public abstract T parseNetworkResponse(Response response) throws Exception;

	public abstract void onError(Call call, Exception e);

	public abstract void onResponse(T response);

	@SuppressWarnings("rawtypes")
	public static ICall<?> CALLBACK_DEFAULT = new ICall() {

		@Override
		public Object parseNetworkResponse(Response response) throws Exception {
			return null;
		}

		@Override
		public void onError(Call call, Exception e) {

		}

		@Override
		public void onResponse(Object response) {

		}
	};
}
